@extends('mobile.layout1')
@section('title','我的社群')

@section('css')
    <link rel="stylesheet" href="{{asset('FENXIAO/js/dropload-gh-pages/dist/dropload.css')}}">
@endsection

@section('aside-bar')

@endsection

@section('content')
<body>
<div class="view-container mgn55">
    <div class="view-inner">
        <div class="team-top">
            {{--
            <div class="team-select">筛选</div>--}}
            <div class="team-name">{{$user->name}}</div>
            <div class="team-num">
                <div>社群总人数：{{$myTeamNumber}}</div>
            </div>
            <div class="team-num">
                {{--<div>共有朋友{{$myFriendNumber}}人</div>--}}
                <div>共有密友{{$user->promotion_number}}人；朋友{{$myFriendSecondNumber}}人</div>
                <div>
                    @foreach($myTeam as $v)
                        @if($v->level!=0)
                            {{$v->name}}   @if(isset($myTeamCount[$v->level]))  {{$myTeamCount[$v->level]}} @else 0人@endif
                            @endif
                    @endforeach
                  </div>
            </div>

            @if(isset($user->leader))
            <div class="team-num">
                <div>您的推荐人：{{$user->leader->name}}</div>
                <div>推荐人编号：{{$user->leader->id}}</div>
            </div>
                @endif
        </div>
        <div class="tab-nav order-nav-tab">
            <a @if(\Illuminate\Support\Facades\Request::fullUrl()==route('myTeam.friend'))class="active" @endif href="{{route('myTeam.friend')}}">密友</a>
            <a @if(\Illuminate\Support\Facades\Request::fullUrl()==route('myTeam.friend',['level'=>2]))  class="active" @endif href="{{route('myTeam.friend',['level'=>2])}}">朋友</a>
        </div>
        <ul class="team-list">


        </ul>
        <div class="jiazai"></div>
    </div>
</div>
<div class="overlay-select">
    <div class="select-wrap">
        <h1>等级筛选</h1>
        <div class="select-icon"></div>
        <div class="select-list">
            @foreach($myTeam as $item)
            <a href="" class="active">会员</a>
            @endforeach

        </div>
    </div>
</div>

</body>
</html>
    @endsection
@section('js')
    <script type="text/javascript" src="{{asset('FENXIAO/js/dropload-gh-pages/dist/dropload.js')}}"></script>

    <script>


        $(function(){
            var tab1LoadEnd = false;

            // tab
            var page = 1;
                    @if(\Illuminate\Support\Facades\Request::fullUrl()==route('myTeam.friend',['level'=>2]))

            var url='{{route('myTeam.level',['level'=>2])}}';
            @else
            var url='{{route('myTeam.level',['level'=>1])}}';
            @endif
            // dropload
            var dropload = $('.jiazai').dropload({
                scrollArea : window,
                loadDownFn : function(me){
                    // 加载菜单一的数据

                    $.ajax({
                        type: 'GET',
                        url: url,
                        data:{page:page},
                        dataType: 'text',
                        success: function(data){
                            var result = '';
                            page++;
                            if(data==''){
                                // 数据加载完
                                tab1LoadEnd = true;
                                // 锁定
                                me.lock();
                                // 无数据
                                me.noData();
                            }
                            $('.team-list').append(data);
                            me.resetload();


                        },
                        error: function(xhr, type){
                            //alert('Ajax error!');
                            // 即使加载出错，也得重置
                            me.resetload();
                        }
                    });
                    // 加载菜单二的数据

                }
            });
        });
    </script>
@endsection

